package com.ruoyi.file.service;

import com.ruoyi.file.utils.OssUtil;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;

@Service
@Primary
public class OssSysFileServiceImpl implements ISysFileService {

    private final OssUtil ossUtil;

    public OssSysFileServiceImpl(OssUtil ossUtil) {
        this.ossUtil = ossUtil;
    }

    @Override
    public String uploadFile(MultipartFile file) throws Exception {
        return ossUtil.upload(file);
    }

    @Override
    public void deleteFile(String fileUrl) throws Exception {
        ossUtil.delete(fileUrl);
    }
}
